<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <script src="./js/earthsdk.js"></script>
    <!-- 自定义Css样式 -->
    <link rel="stylesheet" href="./css/example1.css">
    <title>高斯泼溅数据</title>
    <style>
        html,
        body,
        #app {
            width: 100%;
            height: 100%;
            margin: 0px;
            padding: 0px;
        }

        .box>div {
            display: grid;
            grid-template-columns: 100px 1fr;
            align-items: center;
        }

        .box>button {
            width: 100%;
            margin-top: 5px;
        }

        .tip {
            color: rgb(255, 255, 0);
            font-size: 14px;
            padding-bottom: 10px;
            border-bottom: 2px dotted #979797;
        }
    </style>
</head>

<body>
    <div id="app"></div>
    <div id="panel">
        <div class="box">
            <div><label for="">引用路径：</label>
                <input id="url" type="text"
                    value="http://114.242.26.126:6003/gaosi/point_cloud/iteration_7000/point_cloud.ply"
                    onchange="changeurl()">
            </div>
            <button onclick="flyTo()">飞行定位</button>
        </div>
    </div>
    <script>
        /** ---------------------------------地球创建------------------------------------**/

        // Vue中引入方式：import { ESObjectsManager } from 'esobjs-xe2-plugin/dist-node/esobjs-xe2-plugin-main';

        const { ESObjectsManager } = XE2['esobjs-xe2-plugin-main']
        const objm = new ESObjectsManager();
        window.g_objm = objm;

        // 监听视口创建完成事件
        objm.viewerCreatedEvent.don((viewer) => {
            objm.activeViewer.flyIn([
                116.48642360917361,
                39.91437779088571,
                56.60217231088666
            ], [
                266.2340087890625,
                -48.1486930847168,
                -0.000005946008968749084
            ], 2)
        })

        // 通过json创建一个影像图层
        const imageryLayer = objm.createSceneObjectFromJson({
            "id": "9812a65f-0de0-4f7b-b234-809c0c2fb8ef",
            "type": "ESImageryLayer",
            "maximumLevel": 18,
            "url": "https://server.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"
        });


        /** ---------------------------------!!!高斯泼溅数据------------------------------------**/

        // UE加载高斯泼溅数据
        const { ESGaussianSplatting } = XE2['esobjs-xe2-plugin-main']

        const sceneObj = objm.createSceneObject(ESGaussianSplatting)
        // 高斯泼溅数据
        sceneObj.url = document.getElementById("url").value
        // 位置
        sceneObj.position = [116.48635490000001, 39.914374899999984, 54.29999409875434]
        window.sceneObj = sceneObj


        // 飞行定位
        function flyTo() {
            if (sceneObj) sceneObj.flyTo()
        }

        // 切换url
        function changeurl() {
            if (sceneObj) sceneObj.url = document.getElementById("url").value

        }








    </script>

    <!-- UE引擎面板组件 -->
    <div id="root">
        <create-ue-engine :objm="objm"></create-ue-engine>
    </div>
    <!-- Vue文件 -->
    <script src="./js/vue.global.js"></script>
    <!-- 切换UE和Cesium的组件 -->
    <script src="./js/createUeEngine.js"></script>
</body>

</html>